package com.lujianfei.recyclerview.recyclerview_vertical;

import android.os.Bundle;

import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager2.widget.ViewPager2;

import com.lujianfei.recyclerview.R;
import com.lujianfei.recyclerview.adapter.VerticalViewPagerAdapter;
import com.lujianfei.recyclerview.entity.ListItem;

import java.util.ArrayList;
import java.util.List;

public class ViewPagerVerticalActivity extends AppCompatActivity {

    ViewPager2 viewpager;
    VerticalViewPagerAdapter verticalViewPagerAdapter;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_viewpager_vertical);
        viewpager = findViewById(R.id.viewpager);
        verticalViewPagerAdapter = new VerticalViewPagerAdapter(genData());
        viewpager.setAdapter(verticalViewPagerAdapter);
    }

    private List<ListItem> genData() {
        List<ListItem> listItems = new ArrayList<>();
        for (int i = 0; i < 5; i++) {
            listItems.add(new ListItem("Title "+i,"Summary "+i));
        }
        return listItems;
    }
}
